import axios from 'axios'
axios.defaults.headers['Content-type']="application/json;charset=utf-8"
import store from '@/store/index'
const service=axios.create({
	baseUrl:"",
	timeout:30*1000
})
service.interceptors.request.use(config=>{
	config.data='object'==typeof(config.data)?JSON.stringify(config.data):config.data
	config.headers['authtoken']=store.getters.authtoken
	return config
},error=>{
	return Promise.reject(error)
})
service.interceptors.response.use(response=>{
	if(response.status==200)
	 return response['data']
	return Promise.reject(response)
},error=>{
	return Promise.reject(error)
})
export default service;
